package com.chijun.mform.create.dialog;

import android.content.Context;
import android.view.View;
import android.widget.LinearLayout;

import androidx.annotation.NonNull;

import com.chijun.mform.R;
import com.chijun.mform.create.fragment.FormAddProcessFragment;
import com.chijun.mform.create.mode.FormField;
import com.chijun.mform.create.mode.FormFieldOption;
import com.example.ccj.b.c.dialog.DialogBase;

import java.util.List;

/**
 * 选择审批节点类型
 * 点击后返回
 */
public class SelectProcessTypeDialog extends DialogBase {



    ISelectShenPiJieDianType selectShenPiJieDianType;
    /**
     *
     * @param context 上下文
     * @param selectShenPiJieDianType  选择审批节点类型回调
     */
    public SelectProcessTypeDialog(@NonNull Context context, ISelectShenPiJieDianType selectShenPiJieDianType) {
        super(context);
        this.selectShenPiJieDianType = selectShenPiJieDianType;
    }

    @Override
    public void onInit() {
        isCanClose(true);
        setLayout(R.layout.dialog_selct_process_type);
        setAlpha(1f);//透明度
        isCanClose(true);//点击允许关闭
        isShowBackground(true);//不显示背景
        showInCenter();//底部弹出
        goneTitleLeftImage();

        setTitleCenterText("选择审批节点类型");
        setTitleRightText("OK").setOnClickListener(V->dismiss());

        LinearLayout shenPi = findViewById(R.id.dialog_selct_process_type_shen_pi);
        LinearLayout chaoSong = findViewById(R.id.dialog_selct_process_type_chao_song);

        shenPi.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (selectShenPiJieDianType != null) selectShenPiJieDianType.result(FormAddProcessFragment.SHEN_PI_REN_JIE_DIAN);
                dismiss();
            }
        });

        chaoSong.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (selectShenPiJieDianType != null) selectShenPiJieDianType.result(FormAddProcessFragment.CHAO_SONG_REN_JIE_DIAN);
                dismiss();
            }
        });




    }

}
